VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ILevelNode"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private Type typeLevelNode
 '///currently available types:
 'Empty
 'Wall
 'Player
 'Operation
 'Goal
 'Check
 'Arrow
 'Key
 'Lock
 'Box
 'Hole
 'Box2 (new)
 'Button (new)
 'Trapdoor (new)
 'Ball (new 2)
 'RoundHole (new 2)
 'Teleporter (new 2)
 sType As String
 
 objValue As iValue
 objValue2 As iValue 'optional
 objOperation As IOperation
 nForceType As Long
 nFlags As Long '0x1=hidden
 fMax As Double
 fMin As Double
 sFormat As String
End Type

Private m_t As typeLevelNode

Public Function NewInstanceIfNodeTypeIsSupported(ByVal sNodeType As String) As ILevelNode
Set NewInstanceIfNodeTypeIsSupported = New ILevelNode
End Function

Friend Sub CloneFrom(ByRef t As typeLevelNode)
m_t = t
If Not m_t.objValue Is Nothing Then Set m_t.objValue = m_t.objValue.Clone
If Not m_t.objValue2 Is Nothing Then Set m_t.objValue2 = m_t.objValue2.Clone
If Not m_t.objOperation Is Nothing Then Set m_t.objOperation = m_t.objOperation.Clone
End Sub

Public Function Clone() As ILevelNode
Dim obj As New ILevelNode
obj.CloneFrom m_t
Set Clone = obj
End Function

'return a list of properties (separated by ',') depend on node type
Public Function GetPropertyList() As String
Select Case m_t.sType
Case "Player", "Box", "Ball"
 GetPropertyList = "Value,ForceType,Max,Min,Format"
Case "Goal"
 GetPropertyList = "Format,Hidden"
Case "Operation"
 GetPropertyList = "OneTime,Operation,Value,Value2,Format,Hidden"
Case "Check", "Hole", "RoundHole"
 GetPropertyList = "Operation,Value,Value2,Format,Hidden"
Case "Arrow"
 GetPropertyList = "Direction,Hidden"
Case "Key", "Lock"
 GetPropertyList = "Color,Hidden"
Case "Box2"
 GetPropertyList = "Box2Type,Rotation"
Case "Button"
 GetPropertyList = "ButtonType,Index,Hidden"
Case "Trapdoor"
 GetPropertyList = "TrapdoorType,Index,Hidden"
Case "Teleporter"
 GetPropertyList = "TeleporterType,TargetX,TargetY,Hidden"
End Select
End Function

Public Property Get NodeType() As String
NodeType = m_t.sType
End Property

Public Property Let NodeType(ByVal s As String)
m_t.sType = s
End Property

Public Property Get NodeProperty(ByVal sName As String) As String
Select Case sName
Case "Value"
 If Not m_t.objValue Is Nothing Then
  NodeProperty = m_t.objValue.ToString
 End If
Case "Value2"
 If Not m_t.objValue2 Is Nothing Then
  NodeProperty = m_t.objValue2.ToString
 End If
Case "Operation"
 If Not m_t.objOperation Is Nothing Then
  NodeProperty = m_t.objOperation.OperationType
 End If
Case "ForceType", "Direction", "Color", "OneTime", "Box2Type", "ButtonType", "TrapdoorType", "TeleporterType"
 NodeProperty = CStr(m_t.nForceType)
Case "Max"
 NodeProperty = CStr(m_t.fMax)
Case "Min"
 NodeProperty = CStr(m_t.fMin)
Case "Format"
 NodeProperty = m_t.sFormat
Case "Rotation"
 NodeProperty = CStr(Sgn(m_t.fMin) + 1)
Case "TargetX"
 NodeProperty = CStr(Round(m_t.fMax))
Case "Index", "TargetY"
 NodeProperty = CStr(Round(m_t.fMin))
Case "Hidden"
 NodeProperty = CStr(m_t.nFlags And 1&)
End Select
End Property

Public Property Let NodeProperty(ByVal sName As String, ByVal s As String)
Select Case sName
Case "Value"
 If s = vbNullString Then
  Set m_t.objValue = Nothing
 Else
  Set m_t.objValue = New iValue
  m_t.objValue.FromString s
 End If
Case "Value2"
 Set m_t.objValue2 = New iValue
 m_t.objValue2.FromString s
Case "Operation"
 Set m_t.objOperation = New IOperation
 m_t.objOperation.OperationType = s
Case "ForceType", "Direction", "Color", "OneTime", "Box2Type", "ButtonType", "TrapdoorType", "TeleporterType"
 m_t.nForceType = Val(s)
Case "Max"
 m_t.fMax = Val(s)
Case "Min"
 m_t.fMin = Val(s)
Case "Format"
 m_t.sFormat = s
Case "Rotation"
 m_t.fMin = Val(s) - 1
Case "TargetX"
 m_t.fMax = Round(Val(s))
Case "Index", "TargetY"
 m_t.fMin = Round(Val(s))
Case "Hidden"
 m_t.nFlags = (m_t.nFlags And Not &H1&) Or ((Val(s) <> 0) And &H1&)
End Select
End Property

'used only for drawing walls
'WARNING: don't use this for game logic!!!
Public Property Get IsWall() As Boolean
IsWall = m_t.sType = "Wall"
End Property

'used for game logic
Public Property Get IsEntity() As Boolean
Select Case m_t.sType
Case "Player", "Box", "Box2", "Ball"
 IsEntity = True
End Select
End Property

'used for game logic
Public Property Get IsPlayer() As Boolean
IsPlayer = m_t.sType = "Player"
End Property

'ad-hoc
Friend Function GetValue() As iValue
Set GetValue = m_t.objValue
End Function

'ad-hoc
Friend Function SetValue(ByVal objLevel As clsLevel, ByVal obj As iValue, Optional ByVal bTestOnly As Boolean) As Boolean
On Error Resume Next
Dim obj1 As iValue
Dim n As Double
'///
If Not obj Is Nothing Then
 Set obj1 = obj.Clone
 If obj.ValueType <> IValue_Void Then
  If m_t.nForceType > 0 Then
   If Not obj1.ConvertTo(m_t.nForceType) Then
    Select Case m_t.nForceType
    Case IValue_Integer
     objLevel.ErrorMessage = objText.GetText("Only whole number values are allowed.")
    Case IValue_Rational
     objLevel.ErrorMessage = objText.GetText("Only rational number values are allowed.")
    Case Else
     objLevel.ErrorMessage = objText.GetText("Only real number values are allowed.")
    End Select
    Exit Function
   End If
  End If
  n = obj1.ToDouble
  If n > m_t.fMax Then
   objLevel.ErrorMessage = Replace(objText.GetText("Value can't be above %s."), "%s", CStr(m_t.fMax))
   Exit Function
  ElseIf n < m_t.fMin Then
   objLevel.ErrorMessage = Replace(objText.GetText("Value can't be less than %s."), "%s", CStr(m_t.fMin))
   Exit Function
  End If
 End If
End If
'///
If Not bTestOnly Then Set m_t.objValue = obj1
SetValue = True
End Function

'used for game logic
Public Function BeforePushEntity(ByVal objLevel As clsLevel, ByVal objEntity As ILevelNode, ByVal xBefore As Long, ByVal yBefore As Long, ByVal dx As Long, ByVal dy As Long) As Boolean
If objEntity.IsPlayer Then Exit Function 'can't push player
'///only player and box2 can push other entity
If IsPlayer Then
Else
 Select Case m_t.sType
 Case "Box2"
 Case Else
  Exit Function
 End Select
End If
'///
BeforePushEntity = True
End Function

'used for game logic
Public Function IsEntitySlippery(ByVal objLevel As clsLevel, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long) As Boolean
Dim obj As ILevelNode
'///
Select Case m_t.sType
Case "Ball"
 IsEntitySlippery = True
Case Else
 Set obj = objLevel.LevelNode(x, y)
 If Not obj Is Nothing Then
  Select Case obj.NodeType
  Case "Ice" 'not added to the game yet
   IsEntitySlippery = True
  End Select
 End If
End Select
End Function

'used for game logic
Public Sub AfterPushEntity(ByVal objLevel As clsLevel, ByVal objEntity As ILevelNode, ByVal xBefore As Long, ByVal yBefore As Long, ByVal dx As Long, ByVal dy As Long)
'currently do nothing
End Sub

'used for game logic
Public Function BeforeEntityBeingPushed(ByVal objLevel As clsLevel, ByVal objPusher As ILevelNode, ByVal xBefore As Long, ByVal yBefore As Long, ByVal dx As Long, ByVal dy As Long) As Boolean
'///box2 can only be pushed by specified direction
Select Case m_t.sType
Case "Box2"
 If dx = 0 Then
  If dy < 0 Then 'up
   If (m_t.nForceType And 1&) = 0 Then Exit Function
  ElseIf dy > 0 Then 'down
   If (m_t.nForceType And 2&) = 0 Then Exit Function
  End If
 Else
  If dx < 0 Then 'left
   If (m_t.nForceType And 4&) = 0 Then Exit Function
  ElseIf dx > 0 Then 'right
   If (m_t.nForceType And 8&) = 0 Then Exit Function
  End If
 End If
End Select
'///
BeforeEntityBeingPushed = True
End Function

'used for game logic
Public Sub AfterEntityBeingPushed(ByVal objLevel As clsLevel, ByVal objPusher As ILevelNode, ByVal xBefore As Long, ByVal yBefore As Long, ByVal dx As Long, ByVal dy As Long)
Dim d(3) As Long, tmp As Long
'///check if we should changd the direction of box2 automatically
Select Case m_t.sType
Case "Box2"
 If m_t.fMin Then
  d(0) = ((m_t.nForceType And 1&) <> 0) And 1& 'up
  d(1) = ((m_t.nForceType And 4&) <> 0) And 1& 'left
  d(2) = ((m_t.nForceType And 2&) <> 0) And 1& 'down
  d(3) = ((m_t.nForceType And 8&) <> 0) And 1& 'right
  If m_t.fMin < 0 Then 'counterclockwise
   tmp = d(0): d(0) = d(3): d(3) = d(2): d(2) = d(1): d(1) = tmp
  Else 'clockwise
   tmp = d(0): d(0) = d(1): d(1) = d(2): d(2) = d(3): d(3) = tmp
  End If
  m_t.nForceType = d(0) Or (d(1) * 4&) Or (d(2) * 2&) Or (d(3) * 8&)
 End If
End Select
End Sub

'used for game logic
Public Function BeforeEntityEnter(ByVal objLevel As clsLevel, ByVal objEntity As ILevelNode, ByVal xBefore As Long, ByVal yBefore As Long, ByVal dx As Long, ByVal dy As Long, ByVal IsTeleport As Boolean) As Boolean
Dim objValue As iValue
'///
If m_t.nFlags And 1& Then Exit Function
'///
Select Case m_t.sType
Case "Operation"
 '///check if operation can be performed
 Set objValue = objEntity.GetValue
 If Not objValue Is Nothing And Not m_t.objOperation Is Nothing Then
  Set objValue = m_t.objOperation.Apply(objValue, m_t.objValue, m_t.objValue2)
  If objValue Is Nothing Then 'e.g. log of a negative integer
   Select Case CLng(Val(objEntity.NodeProperty("ForceType")))
   Case IValue_Integer
    objLevel.ErrorMessage = objText.GetText("Only whole number values are allowed.")
   Case IValue_Rational
    objLevel.ErrorMessage = objText.GetText("Only rational number values are allowed.")
   Case Else
    objLevel.ErrorMessage = objText.GetText("Only real number values are allowed.")
   End Select
   Exit Function
  End If
  If Not objEntity.SetValue(objLevel, objValue, True) Then Exit Function
 End If
 '///
 BeforeEntityEnter = True
Case "Empty", "Goal", "Arrow", "Button", "Teleporter"
 BeforeEntityEnter = True
Case "Key"
 BeforeEntityEnter = objEntity.IsPlayer
Case "Lock"
 BeforeEntityEnter = objEntity.IsPlayer And objLevel.KeyCount(m_t.nForceType) > 0
Case "Trapdoor"
 BeforeEntityEnter = m_t.nForceType And 1&
Case "Check", "Hole", "RoundHole"
 Select Case m_t.sType
 Case "Hole"
  If objEntity.NodeType <> "Box" Then Exit Function
 Case "RoundHole"
  If objEntity.NodeType <> "Ball" Then Exit Function
 End Select
 '///check if the condition is satisfied
 Set objValue = objEntity.GetValue
 If Not objValue Is Nothing And Not m_t.objOperation Is Nothing Then
  Set objValue = m_t.objOperation.Apply(objValue, m_t.objValue, m_t.objValue2)
  If objValue Is Nothing Then Exit Function 'e.g. log of a negative integer
  If objValue.ValueType <> IValue_Void Then
   If objValue.ToDouble = 0 Then Exit Function
  End If
 End If
 '///
 BeforeEntityEnter = True
End Select
End Function

'used for game logic
Public Function BeforeEntityLeave(ByVal objLevel As clsLevel, ByVal objEntity As ILevelNode, ByVal xBefore As Long, ByVal yBefore As Long, ByVal dx As Long, ByVal dy As Long, ByVal IsTeleport As Boolean) As Boolean
Select Case m_t.sType
Case "Arrow"
 If IsTeleport Then
  BeforeEntityLeave = True
 Else
  Select Case m_t.nForceType
  Case 0
   BeforeEntityLeave = dx = 0 And dy < 0
  Case 1
   BeforeEntityLeave = dx = 0 And dy > 0
  Case 2
   BeforeEntityLeave = dx < 0 And dy = 0
  Case 3
   BeforeEntityLeave = dx > 0 And dy = 0
  End Select
 End If
Case Else
 BeforeEntityLeave = True
End Select
End Function

'used for game logic
Public Sub AfterEntityEnter(ByVal objLevel As clsLevel, ByVal objEntity As ILevelNode, ByVal xBefore As Long, ByVal yBefore As Long, ByVal dx As Long, ByVal dy As Long, ByVal IsTeleport As Boolean)
Dim i As Long, j As Long
Dim obj As ILevelNode
Dim objValue As iValue
'///
Select Case m_t.sType
Case "Operation"
 '///apply operation
 Set objValue = objEntity.GetValue
 If Not objValue Is Nothing And Not m_t.objOperation Is Nothing Then
  objEntity.SetValue objLevel, m_t.objOperation.Apply(objValue, m_t.objValue, m_t.objValue2)
 End If
 '///remove itself
 If m_t.nForceType Then
  Set objLevel.LevelNode(xBefore + dx, yBefore + dy) = Nothing
 End If
Case "Key"
 objLevel.KeyCount(m_t.nForceType) = objLevel.KeyCount(m_t.nForceType) + 1
 '///remove itself
 Set objLevel.LevelNode(xBefore + dx, yBefore + dy) = Nothing
Case "Lock"
 objLevel.KeyCount(m_t.nForceType) = objLevel.KeyCount(m_t.nForceType) - 1
 '///remove itself
 Set objLevel.LevelNode(xBefore + dx, yBefore + dy) = Nothing
Case "Hole", "RoundHole"
 '///remove box and itself
 Set objLevel.LevelNode(xBefore + dx, yBefore + dy) = Nothing
 Set objLevel.LevelEntity(xBefore + dx, yBefore + dy) = Nothing
Case "Goal"
 '///remove player
 If objEntity.IsPlayer Then
  Set objLevel.LevelEntity(xBefore + dx, yBefore + dy) = Nothing
 End If
Case "Button"
 For j = 0 To objLevel.Height - 1
  For i = 0 To objLevel.Width - 1
   Set obj = objLevel.LevelNode(i, j)
   If Not obj Is Nothing Then
    If obj.NodeType = "Trapdoor" Then
     If CLng(Val(obj.NodeProperty("Index"))) = CLng(m_t.fMin) Then
      obj.NodeProperty("TrapdoorType") = CStr(CLng(Val(obj.NodeProperty("TrapdoorType"))) Or 1&)
     End If
    End If
   End If
  Next i
 Next j
Case "Teleporter"
 If IsTeleport Then Exit Sub 'prevent recursive teleporting
 If objEntity.IsPlayer Then
  If (m_t.nForceType And &H1&) = 0 Then Exit Sub
 Else
  If (m_t.nForceType And &H2&) = 0 Then Exit Sub
 End If
 objLevel.TeleportEntityInternal xBefore + dx, yBefore + dy, CLng(Round(m_t.fMax)), CLng(Round(m_t.fMin))
End Select
End Sub

'used for game logic
Public Sub AfterEntityLeave(ByVal objLevel As clsLevel, ByVal objEntity As ILevelNode, ByVal xBefore As Long, ByVal yBefore As Long, ByVal dx As Long, ByVal dy As Long, ByVal IsTeleport As Boolean)
Dim i As Long, j As Long
Dim obj As ILevelNode
'///
Select Case m_t.sType
Case "Button"
 If m_t.nForceType And 1& Then 'hard button
  For j = 0 To objLevel.Height - 1
   For i = 0 To objLevel.Width - 1
    Set obj = objLevel.LevelNode(i, j)
    If Not obj Is Nothing Then
     If obj.NodeType = "Trapdoor" Then
      If CLng(Val(obj.NodeProperty("Index"))) = CLng(m_t.fMin) Then
       obj.NodeProperty("TrapdoorType") = CStr(CLng(Val(obj.NodeProperty("TrapdoorType"))) And Not 1&)
      End If
     End If
    End If
   Next i
  Next j
 End If
Case "Trapdoor"
 '///close the trapdoor automatically
 If m_t.nForceType And 2& Then m_t.nForceType = m_t.nForceType And Not 1&
End Select
End Sub

'used for game logic
Public Function BeforeUseKey(ByVal objLevel As clsLevel, ByVal objPlayer As ILevelNode, ByVal PlayerX As Long, ByVal PlayerY As Long, ByVal x As Long, ByVal y As Long, ByVal nCurrentKey As Long) As Boolean
Select Case nCurrentKey
Case 4 'hammer
 If m_t.nFlags And 1& Then
  BeforeUseKey = True
 Else
  Select Case m_t.sType
  Case "Box2"
   BeforeUseKey = True
  End Select
 End If
Case 5 'force swap
 Select Case m_t.sType
 Case "Player", "Box", "Box2", "Ball"
  BeforeUseKey = True
 End Select
End Select
End Function

'used for game logic
Public Sub AfterUseKey(ByVal objLevel As clsLevel, ByVal objPlayer As ILevelNode, ByVal PlayerX As Long, ByVal PlayerY As Long, ByVal x As Long, ByVal y As Long, ByVal nCurrentKey As Long)
Dim obj As ILevelNode
Select Case nCurrentKey
Case 4 'hammer
 'no sanity check
 Set obj = objLevel.LevelNode(x, y)
 If Not obj Is Nothing Then
  If Val(obj.NodeProperty("Hidden")) Then
   obj.NodeProperty("Hidden") = "0"
   objLevel.SelectedKey = 0
   Exit Sub
  End If
  obj.AfterEntityLeave objLevel, Me, x, y, 0, 0, False
 End If
 Set objLevel.LevelEntity(x, y) = Nothing
 objLevel.SelectedKey = 0
Case 5 'force swap
 'no sanity check
 Set objLevel.LevelEntity(x, y) = objPlayer
 Set objLevel.LevelEntity(PlayerX, PlayerY) = Me
 objLevel.SelectedKey = 0
End Select
End Sub

Public Sub Draw(ByVal bm As cAlphaDibSection, ByVal nLeft As Long, ByVal nTop As Long, ByVal bSelected As Boolean)
If m_t.nFlags And 1& Then
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 384, 128, , True
 Exit Sub
End If
Select Case m_t.sType
Case "Player"
 If bSelected Then
  bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 64, 0, , True
 Else
  bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 0, 64, , True
 End If
 If Not m_t.objValue Is Nothing Then
  m_t.objValue.Draw bm, nLeft, nTop, 64, 64, vbWhite, m_t.sFormat
 End If
Case "Check"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 64, 64, , True
 If Not m_t.objOperation Is Nothing Then
  m_t.objOperation.Draw bm, nLeft, nTop, 64, 64, vbWhite, m_t.objValue, m_t.objValue2, m_t.sFormat
 End If
Case "Goal"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 128, 64, , True
 If m_t.sFormat <> vbNullString Then
  DrawTextAccordingToSize bm.hdc, m_t.sFormat, nLeft, nTop, 64, 64, vbBlack
 End If
Case "Operation"
 If m_t.nForceType Then
  bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 192, 0, , True
 Else
  bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 128, 0, , True
 End If
 If Not m_t.objOperation Is Nothing Then
  m_t.objOperation.Draw bm, nLeft, nTop, 64, 64, vbWhite, m_t.objValue, m_t.objValue2, m_t.sFormat
 End If
Case "Arrow"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 256 + (m_t.nForceType And 3&) * 64&, 0, , True
Case "Key"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, (m_t.nForceType And 7&) * 64&, 128, , True
Case "Lock"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, (m_t.nForceType And 3&) * 64&, 192, , True
Case "Box"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 256, 64, , True
 If Not m_t.objValue Is Nothing Then
  m_t.objValue.Draw bm, nLeft, nTop, 64, 64, vbWhite, m_t.sFormat
 End If
Case "Ball"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 448, 64, , True
 If Not m_t.objValue Is Nothing Then
  m_t.objValue.Draw bm, nLeft, nTop, 64, 64, vbWhite, m_t.sFormat
 End If
Case "Box2"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 320, 64, , True
 If m_t.fMin > 0 Then
  bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 192, 256, , True
 ElseIf m_t.fMin < 0 Then
  bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 192, 320, , True
 End If
 If m_t.nForceType And 15& Then
  bmTiles.AlphaPaintPicture bm.hdc, nLeft + 8, nTop + 8, 48, 48, (m_t.nForceType And 3&) * 48, 256 + (m_t.nForceType And 12&) * 12, , True
 End If
Case "Hole"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 192, 64, , True
 If Not m_t.objOperation Is Nothing Then
  m_t.objOperation.Draw bm, nLeft, nTop, 64, 64, vbWhite, m_t.objValue, m_t.objValue2, m_t.sFormat
 End If
Case "RoundHole"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 384, 64, , True
 If Not m_t.objOperation Is Nothing Then
  m_t.objOperation.Draw bm, nLeft, nTop, 64, 64, vbWhite, m_t.objValue, m_t.objValue2, m_t.sFormat
 End If
Case "Button"
 If m_t.nForceType And 1& Then 'hard button
  bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 384, 320, , True
  DrawTextAccordingToSize bm.hdc, CStr(Round(m_t.fMin)), nLeft, nTop, 64, 64, vbWhite
 Else 'soft button
  bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 448, 320, , True
  DrawTextAccordingToSize bm.hdc, CStr(Round(m_t.fMin)), nLeft + 16, nTop + 16, 32, 32, vbWhite
 End If
Case "Trapdoor"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 256 + (m_t.nForceType And 1&) * 64&, 320, , True
 DrawTextAccordingToSize bm.hdc, CStr(Round(m_t.fMin)), nLeft, nTop, 64, 64, vbWhite
Case "Teleporter"
 bmTiles.AlphaPaintPicture bm.hdc, nLeft, nTop, 64, 64, 448 - (m_t.nForceType And 2&) * 32&, 384, , True
End Select
End Sub
